home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / tsipp / tsipp.lha / tsipp3.0a / tests / prim.test < prev    next >
Encoding:
Text File  |  1992-11-02  |  8.0 KB  |  317 lines

  1. #==============================================================================
  2. #                                 prim.test
  3. #------------------------------------------------------------------------------
  4. # Test of the Tcl SIPP primitive object creation commands.
  5. #------------------------------------------------------------------------------
  6. # Copyright 1992 Mark Diekhans
  7. # Permission to use, copy, modify, and distribute this software and its
  8. # documentation for any purpose and without fee is hereby granted, provided
  9. # that the above copyright notice appear in all copies.  Mark Diekhans makes
  10. # no representations about the suitability of this software for any purpose.
  11. # It is provided "as is" without express or implied warranty.
  12. #------------------------------------------------------------------------------
  13. # $Id: prim.test,v 2.0 1992/11/02 03:56:00 markd Rel $
  14. #==============================================================================
  15.  
  16. if {[info procs test] == ""} {source testprocs.tcl}
  17.  
  18. #
  19. # Test setup.
  20. #
  21.  
  22. test {primitive-1.1} {
  23.     set shader1 [SippShaderBasic .5 .8 .2 {.2 .5 .8}]
  24.     crange $shader1 0 5
  25. } 0 {shader}
  26.  
  27. #
  28. # Test SippTorus command.
  29. #
  30.  
  31. test {primitive-2.1} {
  32.     SippTorus
  33. } 1 {wrong # args: SippTorus bigradius smallradius radialres tuberes shaderhandle [texture]}
  34.  
  35. test {primitive-2.2} {
  36.     SippTorus 1.1 0.3  1  1 foo
  37. } 1 {invalid shader handle: foo}
  38.  
  39. test {primitive-2.3} {
  40.     SippTorus 1.1 0.3  1  1 $shader1 foo
  41. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  42.  
  43. test {primitive-2.4} {
  44.     SippTorus 1.1 0.3  1.2  1 $shader1
  45. } 1 {expected unsigned integer but got "1.2"}
  46.  
  47. test {primitive-2.5} {
  48.     catch {unset object}
  49.     set object [SippTorus 1.0 .5 3 4 $shader1]
  50.     SippObjectDelete $object
  51.     crange $object 0 5        
  52. } 0 {object}
  53.  
  54. test {primitive-2.6} {
  55.     catch {unset object}
  56.     set object [SippTorus 1.0 .5 3 4 $shader1 NATURAL]
  57.     SippObjectDelete $object
  58.     crange $object 0 5        
  59. } 0 {object}
  60.  
  61. #
  62. # Test SippCone command.
  63. #
  64.  
  65. test {primitive-3.1} {
  66.     SippCone
  67. } 1 {wrong # args: SippCone bottomgradius topradius length resolution shaderhandle [texture]}
  68.  
  69. test {primitive-3.2} {
  70.     SippCone 1.1 0.3  1  1 foo
  71. } 1 {invalid shader handle: foo}
  72.  
  73. test {primitive-3.3} {
  74.     SippCone 1.1 0.3  1  1 $shader1 foo
  75. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  76.  
  77. test {primitive-3.4} {
  78.     SippCone 1.1 0.3  1.2  1.9 $shader1
  79. } 1 {expected unsigned integer but got "1.9"}
  80.  
  81. test {primitive-3.5} {
  82.     catch {unset object}
  83.     set object [SippCone 10.0 1.0 22 10 $shader1]
  84.     SippObjectDelete $object
  85.     crange $object 0 5        
  86. } 0 {object}
  87.  
  88. test {primitive-3.6} {
  89.     catch {unset object}
  90.     set object [SippCone 10.0 1.0 22 10 $shader1 CYLINDRICAL]
  91.     SippObjectDelete $object
  92.     crange $object 0 5        
  93. } 0 {object}
  94.  
  95. #
  96. # Test SippCylinder command.
  97. #
  98.  
  99. test {primitive-4.1} {
  100.     SippCylinder
  101. } 1 {wrong # args: SippCylinder radius length resolution shaderhandle [texture]}
  102.  
  103. test {primitive-4.2} {
  104.     SippCylinder 2.5 1 3 foo
  105. } 1 {invalid shader handle: foo}
  106.  
  107. test {primitive-4.3} {
  108.     SippCylinder 2.5 1 3 $shader1 foo
  109. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  110.  
  111. test {primitive-4.4} {
  112.     SippCylinder 2.5 1 3.5 $shader1
  113. } 1 {expected unsigned integer but got "3.5"}
  114.  
  115. test {primitive-4.5} {
  116.     catch {unset object}
  117.     set object [SippCylinder 10.11 20.4 15 $shader1]
  118.     SippObjectDelete $object
  119.     crange $object 0 5        
  120. } 0 {object}
  121.  
  122. test {primitive-4.6} {
  123.     catch {unset object}
  124.     set object [SippCylinder 10.11 20.4 15 $shader1 SPHERICAL]
  125.     SippObjectDelete $object
  126.     crange $object 0 5        
  127. } 0 {object}
  128.  
  129. #
  130. # Test SippEllipsoid command.
  131. #
  132.  
  133. test {primitive-5.1} {
  134.     SippEllipsoid
  135. } 1 {wrong # args: SippEllipsoid {xradius yradius zradius} resolution shaderhandle [texture]}
  136.  
  137. test {primitive-5.2} {
  138.     SippEllipsoid {1.0 2.5 1.6} 4 foo
  139. } 1 {invalid shader handle: foo}
  140.  
  141. test {primitive-5.3} {
  142.     SippEllipsoid {1.0 2.5 1.6} 4 $shader1 foo
  143. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  144.  
  145. test {primitive-5.4} {
  146.     SippEllipsoid {1.0 2.5 1.6} 6.7 $shader1
  147. } 1 {expected unsigned integer but got "6.7"}
  148.  
  149. test {primitive-5.5} {
  150.     catch {unset object}
  151.     set object [SippEllipsoid {1.0 3.5 6.2} 1 $shader1]
  152.     SippObjectDelete $object
  153.     crange $object 0 5        
  154. } 0 {object}
  155.  
  156. test {primitive-5.6} {
  157.     catch {unset object}
  158.     set object [SippEllipsoid {1.0 3.5 6.2} 1 $shader1 WORLD]
  159.     SippObjectDelete $object
  160.     crange $object 0 5        
  161. } 0 {object}
  162.  
  163. #
  164. # Test SippSphere command.
  165. #
  166.  
  167. test {primitive-6.1} {
  168.     SippSphere
  169. } 1 {wrong # args: SippSphere radius resolution shaderhandle [texture]}
  170.  
  171. test {primitive-6.2} {
  172.     SippSphere 1.1  1 foo
  173. } 1 {invalid shader handle: foo}
  174.  
  175. test {primitive-6.3} {
  176.     SippSphere 1.1  1 $shader1 foo
  177. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  178.  
  179. test {primitive-6.4} {
  180.     SippSphere 1.1 1.9 $shader1
  181. } 1 {expected unsigned integer but got "1.9"}
  182.  
  183. test {primitive-6.5} {
  184.     catch {unset object}
  185.     set object [SippSphere 10.2 10 $shader1]
  186.     SippObjectDelete $object
  187.     crange $object 0 5        
  188. } 0 {object}
  189.  
  190. test {primitive-6.6} {
  191.     catch {unset object}
  192.     set object [SippSphere 10.2 10 $shader1 NATURAL]
  193.     SippObjectDelete $object
  194.     crange $object 0 5        
  195. } 0 {object}
  196.  
  197. #
  198. # Test SippBlock command.
  199. #
  200.  
  201. test {primitive-7.1} {
  202.     SippBlock
  203. } 1 {wrong # args: SippBlock {xsize ysize zsize} shaderhandle [texture]}
  204.  
  205. test {primitive-7.2} {
  206.     SippBlock {1.3 4.5 7.9} foo
  207. } 1 {invalid shader handle: foo}
  208.  
  209. test {primitive-7.3} {
  210.     SippBlock {1.3 4.5 7.9} $shader1 foo
  211. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  212.  
  213. test {primitive-7.4} {
  214.     SippBlock {4.5 x43 7.9} $shader1
  215. } 1 {expected floating-point number but got "x43"}
  216.  
  217. test {primitive-7.5} {
  218.     catch {unset object}
  219.     set object [SippBlock {1.0 20.2 10.1} $shader1]
  220.     SippObjectDelete $object
  221.     crange $object 0 5        
  222. } 0 {object}
  223.  
  224. test {primitive-7.6} {
  225.     catch {unset object}
  226.     set object [SippBlock {1.0 20.2 10.1} $shader1 CYLINDRICAL]
  227.     SippObjectDelete $object
  228.     crange $object 0 5        
  229. } 0 {object}
  230.  
  231. #
  232. # Test SippCube command.
  233. #
  234.  
  235. test {primitive-8.1} {
  236.     SippCube
  237. } 1 {wrong # args: SippCube size shaderhandle [texture]}
  238.  
  239. test {primitive-8.2} {
  240.     SippCube 1.3 foo
  241. } 1 {invalid shader handle: foo}
  242.  
  243. test {primitive-8.3} {
  244.     SippCube 1.3 $shader1 foo
  245. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  246.  
  247. test {primitive-8.4} {
  248.     SippCube x43 $shader1
  249. } 1 {expected floating-point number but got "x43"}
  250.  
  251. test {primitive-8.5} {
  252.     catch {unset object}
  253.     set object [SippCube 1.11 $shader1]
  254.     SippObjectDelete $object
  255.     crange $object 0 5
  256. } 0 {object}
  257.  
  258. test {primitive-8.6} {
  259.     catch {unset object}
  260.     set object [SippCube 1.11 $shader1 SPHERICAL]
  261.     SippObjectDelete $object
  262.     crange $object 0 5
  263. } 0 {object}
  264.  
  265. #
  266. # Test SippPrism command.
  267. #
  268.  
  269. set 2dlist {{1 1} {2 2} {3 3} {4 4} {5 5}}
  270.  
  271. test {primitive-9.1} {
  272.     SippPrism
  273. } 1 {wrong # args: SippPrism 2dpointlist length shaderhandle [texture]}
  274.  
  275. test {primitive-9.2} {
  276.     SippPrism $2dlist 10 foo
  277. } 1 {invalid shader handle: foo}
  278.  
  279. test {primitive-9.3} {
  280.     SippPrism $2dlist 10 $shader1 foo
  281. } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
  282.  
  283. test {primitive-9.4} {
  284.     SippPrism $2dlist x43 $shader1
  285. } 1 {expected floating-point number but got "x43"}
  286.  
  287. test {primitive-9.5} {
  288.     SippPrism {1 2 3} 10 $shader1
  289. } 1 {a 2D point must be a list of two elements}
  290.  
  291. test {primitive-9.6} {
  292.     SippPrism {{1 2} 3} 10 $shader1
  293. } 1 {2d point list must contain at least 3 points}
  294.  
  295. test {primitive-9.7} {
  296.     catch {unset object}
  297.     set object [SippPrism $2dlist 10 $shader1]
  298.     SippObjectDelete $object
  299.     crange $object 0 5
  300. } 0 {object}
  301.  
  302. test {primitive-9.8} {
  303.     catch {unset object}
  304.     set object [SippPrism $2dlist 10 $shader1 SPHERICAL]
  305.     SippObjectDelete $object
  306.     crange $object 0 5
  307. } 0 {object}
  308.  
  309. #
  310. # Cleanup.
  311. #
  312.  
  313. test {primitive-9.1} {
  314.     SippShaderDelete $shader1
  315. } 0 {}
  316.  
  317.